package com.xyht.sca_s.student_manage_system.modules.trainingSchool.controller;


import com.xyht.sca_s.student_manage_system.common.annotation.RequestPass;
import com.xyht.sca_s.student_manage_system.common.commonReturn.CommonResult;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.appDynamic.entity.req.AppBasicInfoReq;
import com.xyht.sca_s.student_manage_system.modules.trainingSchool.entity.req.SmsTsProfessionReq;
import com.xyht.sca_s.student_manage_system.modules.trainingSchool.service.SmsTsProfessionService;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.req.SmsWnsIdListReq;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 行业表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-05-15
 */
@RestController
@SecretBody
@RequestMapping("/trainingSchool/profession")
public class SmsTsProfessionController {

    @Resource
    private SmsTsProfessionService smsTsProfessionService;

    @ApiOperation(value = "添加行业")
    @PostMapping("/add")
    public ResponseResult add(@RequestBody SmsTsProfessionReq req) {
        return smsTsProfessionService.add(req);
    }

    @ApiOperation(value = "删除行业")
    @PostMapping("/delete")
    public ResponseResult delete(@RequestBody SmsWnsIdListReq req) {
        smsTsProfessionService.removeByIds(req.getIdList());
        return CommonResult.success();
    }

    @RequestPass
    @ApiOperation(value = "行业列表")
    @GetMapping("/list")
    public ResponseResult list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                               @RequestParam(value = "ss", required = false) String ss) {
        return smsTsProfessionService.list(pageNum, pageSize, ss);
    }

    @ApiOperation(value = "修改行业")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody SmsTsProfessionReq req) {
        return smsTsProfessionService.update(req);
    }


}

